package cn.iocoder.yudao.module.mini.dal.mysql.healthy;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.mini.dal.dataobject.healthy.HealthyDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.mini.controller.admin.healthy.vo.*;

/**
 * 技师健康档案 Mapper
 *
 * @author dzy
 */
@Mapper
public interface HealthyMapper extends BaseMapperX<HealthyDO> {

    default PageResult<HealthyDO> selectPage(HealthyPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<HealthyDO>()
                .eqIfPresent(HealthyDO::getMemberId, reqVO.getMemberId())
                .eqIfPresent(HealthyDO::getNucleicAcid, reqVO.getNucleicAcid())
                .eqIfPresent(HealthyDO::getNovelCoronavirus, reqVO.getNovelCoronavirus())
                .eqIfPresent(HealthyDO::getTemperature, reqVO.getTemperature())
                .eqIfPresent(HealthyDO::getContact, reqVO.getContact())
                .eqIfPresent(HealthyDO::getTrip, reqVO.getTrip())
                .eqIfPresent(HealthyDO::getIdentity, reqVO.getIdentity())
                .eqIfPresent(HealthyDO::getBackground, reqVO.getBackground())
                .eqIfPresent(HealthyDO::getMajor, reqVO.getMajor())
                .eqIfPresent(HealthyDO::getHealthy, reqVO.getHealthy())
                .inIfPresent(HealthyDO::getId, reqVO.getMemberIds())
                .betweenIfPresent(HealthyDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(HealthyDO::getId));
    }

    default List<HealthyDO> selectList(HealthyExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<HealthyDO>()
                .eqIfPresent(HealthyDO::getMemberId, reqVO.getMemberId())
                .eqIfPresent(HealthyDO::getNucleicAcid, reqVO.getNucleicAcid())
                .eqIfPresent(HealthyDO::getNovelCoronavirus, reqVO.getNovelCoronavirus())
                .eqIfPresent(HealthyDO::getTemperature, reqVO.getTemperature())
                .eqIfPresent(HealthyDO::getContact, reqVO.getContact())
                .eqIfPresent(HealthyDO::getTrip, reqVO.getTrip())
                .eqIfPresent(HealthyDO::getIdentity, reqVO.getIdentity())
                .eqIfPresent(HealthyDO::getBackground, reqVO.getBackground())
                .eqIfPresent(HealthyDO::getMajor, reqVO.getMajor())
                .eqIfPresent(HealthyDO::getHealthy, reqVO.getHealthy())
                .betweenIfPresent(HealthyDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(HealthyDO::getId));
    }

}
